label: Respect box-shadow when computing clip
authorBenjamin Otte <otte@redhat.com>
Wed, 20 Aug 2014 22:02:29 +0000 (00:02 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 20 Aug 2014 22:54:07 +0000 (00:54 +0200)
Testclase included.

Also reorder headers to be alphabetic.

gtk/gtklabel.c
testsuite/reftests/Makefile.am
testsuite/reftests/label-box-shadow-clip.css [new file with mode: 0644]
testsuite/reftests/label-box-shadow-clip.ref.ui [new file with mode: 0644]
testsuite/reftests/label-box-shadow-clip.ui [new file with mode: 0644]

index 906d56e9f5942ca27856536d7bb473ad8bbf2967..bf8d101bfd9c922760561e51af934e999bc0c668 100644 (file)
 #include "gtklabel.h"
 #include "gtklabelprivate.h"
 #include "gtkaccellabel.h"
+#include "gtkbindings.h"
+#include "gtkbuildable.h"
+#include "gtkclipboard.h"
 #include "gtkcssshadowsvalueprivate.h"
 #include "gtkdnd.h"
-#include "gtkmarshalers.h"
-#include "gtkpango.h"
-#include "gtkwindow.h"
-#include "gtkclipboard.h"
+#include "gtkimage.h"
 #include "gtkintl.h"
-#include "gtkseparatormenuitem.h"
-#include "gtktextutil.h"
 #include "gtkmain.h"
+#include "gtkmarshalers.h"
 #include "gtkmenuitem.h"
 #include "gtkmenushellprivate.h"
 #include "gtknotebook.h"
-#include "gtkbindings.h"
-#include "gtkbuildable.h"
-#include "gtkimage.h"
+#include "gtkpango.h"
+#include "gtkprivate.h"
+#include "gtkseparatormenuitem.h"
 #include "gtkshow.h"
 #include "gtkstylecontextprivate.h"
+#include "gtktextutil.h"
 #include "gtktooltip.h"
-#include "gtkprivate.h"
 #include "gtktypebuiltins.h"
-#include "gtkmain.h"
+#include "gtkwidgetprivate.h"
+#include "gtkwindow.h"
 
 #include "a11y/gtklabelaccessibleprivate.h"
 
@@ -3997,7 +3997,7 @@ gtk_label_size_allocate (GtkWidget     *widget,
 
   gtk_label_get_ink_rect (label, &clip_rect);
   gdk_rectangle_union (&clip_rect, allocation, &clip_rect);
-  gtk_widget_set_clip (widget, &clip_rect);
+  _gtk_widget_set_simple_clip (widget, &clip_rect);
 }
 
 static void
index 336a507c4878cce17a8c598b6708175574f834e8..0b39b41dfdb26b44d1e94b45f86ab1aa9178925a 100644 (file)
@@ -252,6 +252,9 @@ testdata = \
        label-background.css \
        label-background.ref.ui \
        label-background.ui \
+       label-box-shadow-clip.css \
+       label-box-shadow-clip.ref.ui \
+       label-box-shadow-clip.ui \
        label-clipping.css \
        label-clipping.ref.ui \
        label-clipping.ui \
diff --git a/testsuite/reftests/label-box-shadow-clip.css b/testsuite/reftests/label-box-shadow-clip.css
new file mode 100644 (file)
index 0000000..1aa8006
--- /dev/null
@@ -0,0 +1,9 @@
+@import "reset-to-defaults.css";
+
+.test {
+  box-shadow: 0 0 0 1px red;
+}
+
+.reference {
+  border: 1px solid red;
+}
diff --git a/testsuite/reftests/label-box-shadow-clip.ref.ui b/testsuite/reftests/label-box-shadow-clip.ref.ui
new file mode 100644 (file)
index 0000000..31f744d
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.1 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">100</property>
+    <property name="height_request">100</property>
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <child>
+      <object class="GtkLabel" id="label1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <property name="label" translatable="yes">X</property>
+        <style>
+          <class name="reference"/>
+        </style>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/label-box-shadow-clip.ui b/testsuite/reftests/label-box-shadow-clip.ui
new file mode 100644 (file)
index 0000000..0374162
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.1 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">100</property>
+    <property name="height_request">100</property>
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <child>
+      <object class="GtkLabel" id="label1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <property name="label" translatable="yes">X</property>
+        <style>
+          <class name="test"/>
+        </style>
+      </object>
+    </child>
+  </object>
+</interface>